home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2006 May
/
PCWMAY06.iso
/
Software
/
Freeware
/
First Page 2006 3.00
/
fp2006-final-3.00-setup.exe
/
{app}
/
Iscripts
/
Equivalents
/
img-resizer.izs
< prev
next >
Wrap
Text File
|
2005-09-27
|
8KB
|
269 lines
<!NOWIZARD>
<!TITLE>Image Resizer
<!/TITLE>
<!DESCRIPTION>Browse your computer for an image and this script will tell you its size!<!/DESCRIPTION>
<!CATEGORY>Equivalents<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL IMAGE RESIZER:
1. Copy code into the HEAD section of document
2. Add the onLoad event handler into the BODY tag
3. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<style>
.divstyle{position:absolute; width="0";height:"0"}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function showimg(form)
{
adres = form.image_file.value;
index = adres.indexOf(".gif");
index = index + adres.indexOf(".jpg");
index = index + adres.indexOf(".bmp");
if (form.image_file.value == "")
{alert("No Image found!");}
else
{if (index == -3){alert("Unknow image type");
form.width.value=0;
form.height.value=0;}
else
{
var img_obj = new Image();
img_obj = form.image_file.value;
document.changing.src = img_obj;
document.changing2.src= img_obj;
document.changing.width = document.changing2.width;
document.changing.height = document.changing2.height;
set();
}
}
}
fast = 0;
change = 0;
function upw(){
document.image.width.value=parseInt(document.image.width.value)+1;
resize();}
function over_upw(){upw();
change = 1;
changetime = setTimeout("fast_upw()","600");}
function fast_upw(){clearTimeout(changetime);
upw();
fast = setTimeout("fast_upw()","100");}
function clt(){
if (change == 1){clearTimeout(changetime);}
clearTimeout(fast);
change = 0;
}
function resize() {document.changing.height = document.image.height.value;
document.changing.width = document.image.width.value;}
function downw(){document.image.width.value=parseInt(document.image.width.value)-1;
resize();}
function over_downw(){downw();
change = 1;
changetime = setTimeout("fast_downw()","600");}
function fast_downw(){clearTimeout(changetime);
downw();
fast = setTimeout("fast_downw()","100");}
function uph(){document.image.height.value=parseInt(document.image.height.value)+1;
resize();}
function over_downh(){downh();
change = 1;
changetime = setTimeout("fast_downh()","600");}
function fast_downh(){clearTimeout(changetime);
downh();
fast = setTimeout("fast_downh()","100");}
function over_uph(){uph();
change = 1;
changetime = setTimeout("fast_uph()","600");}
function fast_uph(){clearTimeout(changetime);
uph();
fast = setTimeout("fast_uph()","100");}
function downh(){document.image.height.value=parseInt(document.image.height.value)-1;
resize();}
function set(){
document.image.width.value=document.changing.width;
document.image.height.value=document.changing.height;}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="set()">
<!-- STEP THREE: Copy code into BODY section of document -->
<center>
<form name="image">
<input type="file" name="image_file"><br><br>
<input type="button" name="show" value="Show image" onclick="showimg(this.form)">
<br><br>
Width Heigth
<br><img src="/img/image-resizer/up.gif" onmousedown="over_upw()" onmouseup="clt()">
<img src="/img/image-resizer/down.gif" onmousedown="over_downw()" onmouseup="clt()">
<input type="text" name="width" size="4" readonly>
<input type="text" name="height" size="4" readonly>
<img src="/img/image-resizer/up.gif" onmousedown="over_uph()" onmouseup="clt()" >
<img src="/img/image-resizer/down.gif" onmousedown="over_downh()" onmouseup="clt()">
<br><br>
<table border ="2">
<tr><td>
<img src="/img/image-resizer/1.gif" name="changing">
</td></tr></table>
</form>
<div STYLE="left:-5000 px;top:0" class="divstyle">
<P ><img src="/img/image-resizer/1.gif" name="changing2"></p>
</div>
</center>
<!-- END OF SCRIPT -->
<!/SCRIPT>
<!PREVIEW>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL IMAGE RESIZER:
1. Copy code into the HEAD section of document
2. Add the onLoad event handler into the BODY tag
3. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<style>
.divstyle{position:absolute; width="0";height:"0"}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function showimg(form)
{
adres = form.image_file.value;
index = adres.indexOf(".gif");
index = index + adres.indexOf(".jpg");
index = index + adres.indexOf(".bmp");
if (form.image_file.value == "")
{alert("No Image found!");}
else
{if (index == -3){alert("Unknow image type");
form.width.value=0;
form.height.value=0;}
else
{
var img_obj = new Image();
img_obj = form.image_file.value;
document.changing.src = img_obj;
document.changing2.src= img_obj;
document.changing.width = document.changing2.width;
document.changing.height = document.changing2.height;
set();
}
}
}
fast = 0;
change = 0;
function upw(){
document.image.width.value=parseInt(document.image.width.value)+1;
resize();}
function over_upw(){upw();
change = 1;
changetime = setTimeout("fast_upw()","600");}
function fast_upw(){clearTimeout(changetime);
upw();
fast = setTimeout("fast_upw()","100");}
function clt(){
if (change == 1){clearTimeout(changetime);}
clearTimeout(fast);
change = 0;
}
function resize() {document.changing.height = document.image.height.value;
document.changing.width = document.image.width.value;}
function downw(){document.image.width.value=parseInt(document.image.width.value)-1;
resize();}
function over_downw(){downw();
change = 1;
changetime = setTimeout("fast_downw()","600");}
function fast_downw(){clearTimeout(changetime);
downw();
fast = setTimeout("fast_downw()","100");}
function uph(){document.image.height.value=parseInt(document.image.height.value)+1;
resize();}
function over_downh(){downh();
change = 1;
changetime = setTimeout("fast_downh()","600");}
function fast_downh(){clearTimeout(changetime);
downh();
fast = setTimeout("fast_downh()","100");}
function over_uph(){uph();
change = 1;
changetime = setTimeout("fast_uph()","600");}
function fast_uph(){clearTimeout(changetime);
uph();
fast = setTimeout("fast_uph()","100");}
function downh(){document.image.height.value=parseInt(document.image.height.value)-1;
resize();}
function set(){
document.image.width.value=document.changing.width;
document.image.height.value=document.changing.height;}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="set()">
<!-- STEP THREE: Copy code into BODY section of document -->
<center>
<form name="image">
<input type="file" name="image_file"><br><br>
<input type="button" name="show" value="Show image" onclick="showimg(this.form)">
<br><br>
Width Heigth
<br><img src="/img/image-resizer/up.gif" onmousedown="over_upw()" onmouseup="clt()">
<img src="/img/image-resizer/down.gif" onmousedown="over_downw()" onmouseup="clt()">
<input type="text" name="width" size="4" readonly>
<input type="text" name="height" size="4" readonly>
<img src="/img/image-resizer/up.gif" onmousedown="over_uph()" onmouseup="clt()" >
<img src="/img/image-resizer/down.gif" onmousedown="over_downh()" onmouseup="clt()">
<br><br>
<table border ="2">
<tr><td>
<img src="/img/image-resizer/1.gif" name="changing">
</td></tr></table>
</form>
<div STYLE="left:-5000 px;top:0" class="divstyle">
<P ><img src="/img/image-resizer/1.gif" name="changing2"></p>
</div>
</center>
<!-- END OF SCRIPT -->
<!/PREVIEW>
<!RELATED>NONE<!/RELATED>